package com.bestcem.xm.component.logging.configure;

import com.bestcem.xm.component.logging.aspect.WebLogAspect;
import com.bestcem.xm.component.logging.properties.WebLogProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({WebLogProperties.class})
@ConditionalOnProperty(prefix = "xm.weblog", name = "enabled", havingValue = "true", matchIfMissing = false)
public class WebLogAutoConfigure {

    @Bean
    @ConditionalOnMissingBean
    public WebLogAspect controllerLogAspect() {
        return new WebLogAspect();
    }

}
